tools/xenstored: Don't leak a file handle when creating the pidfile
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 25 Nov 2013 11:07:44 +0000 (11:07 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Mon, 25 Nov 2013 12:28:41 +0000 (12:28 +0000)
Coverity ID: 1055849

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/xenstore/xenstored_posix.c

index 25bdf7471696b2d2621788dffb281929ee569891..0c93e6d688ca23cbf054a34e2dbfa2978cb360f9 100644 (file)
@@ -44,6 +44,8 @@ void write_pidfile(const char *pidfile)
        len = snprintf(buf, sizeof(buf), "%ld\n", (long)getpid());
        if (write(fd, buf, len) != len)
                barf_perror("Writing pid file %s", pidfile);
+
+       close(fd);
 }
 
 /* Stevens. */